import { request } from '@/utils/request';
import { PageParams } from "@/api/model/pageParams";

export const page = async (params: PageParams) => {
    return request.post({
        url: '/sysRole/page',
        data: params
    });
}

export const insertApi = async (data: any) => {
    return request.post({
        url: '/sysRole/insert',
        data
    });
}

export const updateApi = async (data: any) => {
    return request.post({
        url: '/sysRole/update',
        data
    });
}

export const deleteById = async (id: string) => {
    return request.get({
        url: `/sysRole/delete/${id}`,
    });
}

export const getPermission = async (roleId: string) => {
    return request.get({
        url: `/sysRole/getPermission/${roleId}`,
    });
}

export const roleCheck = async (params: { roleId: string, permissionId: string[] , check: boolean }) => {
    return request.post({
        url: `/sysRole/check`,
        data:params
    });
}

export const getOptions = async () => {
    return request.get({
        url: `/sysRole/roleOptions`,
    });
}
